/**
 * @param {string} s
 * @return {number}
 */
 var minMovesToMakePalindrome = function(s) {
  const n = s.length
  const arr = s.split('')
  let ans = 0, j = n-1
  for(let i = 0; i<j; i++) {
    for(let k = j; k>=i; k--) {
      if(i === k) {
        ans += Math.floor(n/2) -i
      }
      else if(arr[i] === arr[k]) {
        for(let m = k; m<j; m++) {
          let temp = arr[m]
          arr[m] = arr[m+1]
          arr[m+1] = temp
          ans++
        }
        j--
        break
      }
    }
  }
  return ans
};